<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"

      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"

      >
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="../Master/adminMaster.xhtml">
            <ui:define name="page-content">
                <section class="grid_12" id="dashtabs">
                    <div class="box-header">
                        Solutions Manager
                        <ul class="controls"></ul>
                    </div>
                    <div id="dashtabs-pages" class="box-content no-padding">
                        <h:form id="form">  

                            <p:dataTable var="solution" value="#{solutionBean.solution}"  id="complaintss"  widgetVar="complaintTable" paginator="true" rows="10"  
                                         emptyMessage="No complaints found with given criteria" filteredValue="#{solutionBean.flitterSolution}"    >  
                                <f:facet name="header">  
                                    <span style="float: left">Solution of #{solutionBean.complaintSelected.complaintTitle}</span> 
                                    <p:outputPanel>  
                                        <p:inputText id="globalFilter" onkeyup="complaintTable.filter()" style="width:200px;float: right" />  
                                        <h:outputText value="Search all fields:" style="float: right;margin-right: 5px"/>&nbsp;&nbsp;

                                    </p:outputPanel>  
                                </f:facet>  

                                <p:column headerText="Creator" sortBy="#{solution.membersID.membersName}" filterBy="#{solution.membersID.membersName}" id="Title"   filterMatchMode="contains" width="300">  
                                    #{solution.membersID.membersName} 
                                </p:column>  



                                <p:column headerText="Create Date" sortBy="#{solution.solutionCreateDate}" filterBy="#{solution.solutionCreateDate}" id="Category" filterMatchMode="contains" width="120">  
                                    <h:outputText value="#{solution.solutionCreateDate}" >
                                        <f:convertDateTime pattern="dd/MM/yyyy HH:mm" />
                                    </h:outputText> 
                                </p:column>  

                                <p:column headerText="Options"  >  

                                    <p:commandLink oncomplete="dlgResponse.show()" update=":form:display" title="Response">
                                        <p:graphicImage value="../CSS/images/pencil.png"></p:graphicImage>
                                        <f:setPropertyActionListener value="#{solution}" target="#{solutionBean.solutionSelected}" />  
                                    </p:commandLink>
                                    <h:panelGroup rendered="#{login.customer.membersRole == 2}">
                                        <h:commandLink  title="Delete" action="#{solutionBean.deleteSolution(solution)}" onclick="javascript: return confirm('Are you sure remove solution ?')">
                                            <p:graphicImage value="../CSS/images/cross_circle.png"></p:graphicImage>
                                        </h:commandLink>
                                    </h:panelGroup>

                                </p:column>
                            </p:dataTable>  

                            <p:dialog id="dialog" header="Solution" widgetVar="dlgResponse" >  

                                <p:ajax event="close" listener="#{solutionBean.closeDialog()}"/> 
                                <p:panel id="display" style="border: none"> 
                                    <p:panel id="report" style="border: none" > 
                                        <h:panelGroup rendered="#{!solutionBean.alert.equals('aa')}">
                                            <div class="notification success png_bg">

                                                <div>
                                                    #{solutionBean.alert}
                                                </div>
                                            </div>
                                        </h:panelGroup>
                                    </p:panel>

                                    <p:row>
                                        <p:column><h:outputLabel value="Solution: " style="vertical-align: top"/></p:column>   
                                        <p:column><p:editor id="editor"  value="#{solutionBean.solutionContent}"/></p:column> 
                                    </p:row>
                                    <p:row> 
                                        <p:column></p:column>
                                        <p:column><p:commandButton  value="Edit Solution" update="report,complaintss" actionListener="#{solutionBean.editSolution(solutionBean.solutionSelected)}"/></p:column> 
                                    </p:row> 
                                </p:panel>  

                            </p:dialog>

                        </h:form>  
                    </div>

          
                </section>
                <br class="cl" />
            </ui:define>
        </ui:composition>
    </h:body>
</html>

